<template>
  <div class="fileList">
    <div
        v-for="(item,index) in files"
        :key="item+index"
        class="item"
    >
      <app-avatar :size="40" :src="item"></app-avatar>
    </div>
  </div>
</template>

<script lang="ts" setup>
import {computed} from "vue";

const props = defineProps({
  urls: {
    type: String,
    default: ''
  }
});

const files = computed(()=>{
  const arr = props.urls.split(',')
  if (arr.length > 0 && arr[0].length > 1) {
    const objs: string[] = []
    arr.forEach((item) => {
      objs.push(item)
    })
    return  objs
  } else {
    return []
  }
})

</script>

<style lang="scss" scoped>

div.fileList{
  display: flex;
  justify-content: flex-start;
  align-items: center;

  &>div{
    margin-right: 3px;
  }
}

</style>
